﻿<UserControl x:Class="CmdletHelpEditor.UI.UserControls.ExampleControl"
			 x:Name="Example"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:c="clr-namespace:CmdletHelpEditor.Controls"
             mc:Ignorable="d"
			 d:DataContext="{d:DesignInstance c:ClosableTabItem}">
	<DockPanel>
		<StackPanel DockPanel.Dock="Top"
                    IsEnabled="{Binding EditorContext.ExampleContext.ExampleTextBoxEnabled}"
                    Margin="10">
            <TextBlock>
                <Run Text="Example name:"/>
                <Run Text="*"
                     Foreground="Red"
                     FontWeight="Bold"></Run>
            </TextBlock>
			<TextBox MinLines="1"
                     MaxLines="1"
                     Text="{Binding EditorContext.ExampleContext.CurrentExample.Name}"/>
            <TextBlock Text="Example command:"/>
            <TextBox MinLines="10"
                     MaxLines="10"
                     Text="{Binding EditorContext.ExampleContext.CurrentExample.Cmd}"/>
            <TextBlock Text="Example description:"/>
            <TextBox MinLines="10"
                     MaxLines="10"
                     Text="{Binding EditorContext.ExampleContext.CurrentExample.Description}"
                     Tag="AllowFormat"/>
            <TextBlock Text="Example output:"/>
			<TextBox MinLines="10"
                     MaxLines="10"
                     Text="{Binding EditorContext.ExampleContext.CurrentExample.Output}"/>
        </StackPanel>
		<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
		<ListBox Margin="10,0,10,0"
				 Name="lbExamples"
				 HorizontalAlignment="Left"
				 Height="150"
				 VerticalAlignment="Top"
				 Width="350"
				 SelectedIndex="{Binding EditorContext.ExampleContext.CurrentExampleIndex}"
				 SelectedItem="{Binding EditorContext.ExampleContext.CurrentExample}"
				 ItemsSource="{Binding EditorContext.CurrentCmdlet.Examples}"
				 DisplayMemberPath="Name"
		         x:FieldModifier="private" />
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition/>
					<RowDefinition Height="10"/>
					<RowDefinition/>
				</Grid.RowDefinitions>
				<Button Grid.Row="0"
                        VerticalAlignment="Bottom"
                        Width="24"
                        IsEnabled="{Binding EditorContext.ExampleContext.UpExampleEnabled}"
                        Command="{Binding EditorContext.ExampleContext.UpExampleCommand}"
                        ToolTip="Move example up">
					<Image Source="/Images/up_32x32.png"/>
				</Button>
				<Button Grid.Row="2"
                        VerticalAlignment="Top"
                        Width="24"
                        IsEnabled="{Binding EditorContext.ExampleContext.DownExampleEnabled}"
                        Command="{Binding EditorContext.ExampleContext.DownExampleCommad}"
                        ToolTip="Move example down">
					<Image Source="/Images/down_32x32.png"/>
				</Button>
			</Grid>
		</StackPanel>
		<StackPanel DockPanel.Dock="Bottom"
                    Orientation="Horizontal"
                    Margin="10">
			<Button Content="New"
                    Width="75"
                    Command="{Binding EditorContext.ExampleContext.NewExampleCommand}"/>
			<Button Content="Remove"
                    Width="75"
                    IsEnabled="{Binding EditorContext.ExampleContext.RemoveExampleEnabled}"
                    Command="{Binding EditorContext.ExampleContext.RemoveExampleCommand}"
                    Margin="10,0,0,0"/>
		</StackPanel>
	</DockPanel>
</UserControl>
